/**
 * Created by yy on 2017/8/17.
 */
$(function(){
    var url = server + '/server/authentication/healthCard.json';
    $.post(url, function(data){
        if (data.code == 12000) {
            alert("登录超时");
            window.location.replace('../../login.html');
        }
        if(data.code==20001){
            var ctx = template('./health-card-tpl', data);
            $("#health-card").html(ctx);
        }
        hasHealthCard();
    });
    //判断健康卡是否已添加
    function hasHealthCard() {
        var idBox1 = $('.card-box:nth-child(1)');
        var idBox2 = $('.card-box:nth-child(2)');

        if (1/*idBox1.find('h6').text() !== ''*/) {
            idBox2.addClass('hidden');
            idBox1.css('display', 'block');
            $('#card-status').html('更换健康卡');
        }
        else {
            idBox2.removeClass('hidden');
            idBox1.css('display', 'none');
            $('#card-status').html('添加健康卡');
        }
    }
});